package com.fjec.market.schedule.handler;

import com.fjec.market.mapper.BizPhysicalOrderMapper;
import com.fjec.market.service.IBizPhysicalOrderService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Component
public class YsSignHandler {
    @Resource
    private BizPhysicalOrderMapper bizPhysicalOrderMapper;

    @Resource
    private IBizPhysicalOrderService bizPhysicalOrderService;


    public String handle(int limit) {
        List<Map<String, Object>> orderInfos = bizPhysicalOrderMapper.getSignedOrdersToSyncYs(limit);
        StringBuilder sb = new StringBuilder();
        for (Map<String, Object> orderInfo : orderInfos) {
            String log = bizPhysicalOrderService.handleYsSign(orderInfo);
            sb.append(log).append("\n");
        }
        return sb.toString();
    }
}
